set theString to ""
tell application "Microsoft Word"
	local theShape, theRange, theHeaderFooters, theHeaderFooter
	--first find and replace in the body (main story) of document
	set theString to theString & content of text object of active document
	
	--nowin all shapes
	set allShapes to (every shape of active document)
	repeat with theShape in allShapes
		set theTextFrame to (text frame of theShape)
		if has text of (text frame of theShape) then
			set theString to theString & content of text object of theShape
		end if
	end repeat
	
	-- now in the headers and footers of each section
	set allSections to every section of active document
	repeat with theSection in allSections
		set theHeaderFooters to {get header theSection index header footer primary} & {get header theSection index header footer first page} & {get header theSection index header footer even pages} & {get footer theSection index header footer primary} & {get footer theSection index header footer first page} & {get footer theSection index header footer even pages}
		
		repeat with theHeaderFooter in theHeaderFooters
			set theString to theString & content of text object of theHeaderFooter
			
			--now in their shapes
			set allShapes to (every shape of theHeaderFooter)
			repeat with theShape in allShapes
				if has text of (text frame of theShape) then
					set theString to theString & content of text object of theShape
				end if
			end repeat
		end repeat
	end repeat
end tell
return theString
